package system;
import java.awt.BorderLayout;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
@SuppressWarnings("serial")
public class  UserLogin extends JFrame {
	private JTextField fieldAccount = new JTextField();
	private JPasswordField fieldPassword = new JPasswordField();
	private JButton buttonLogin = new JButton("登录");
	public static void main(String[] args) {
	new UserLogin();
	}
public UserLogin() {
this.setTitle("用户登录");
this.setLocation(500, 400);
this.setSize(400, 500);
this.setLayout(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setResizable(false);
//用户账号
JLabel labelAccount = new JLabel("账号");
labelAccount.setAlignmentY(CENTER_ALIGNMENT);
labelAccount.setBounds(50, 100, 100, 30);
fieldAccount.setBounds(150, 100, 100, 30);
this.getContentPane().add(labelAccount);
this.getContentPane().add(fieldAccount);
//用户密码
JLabel labelPwd = new JLabel("密码");
labelPwd.setAlignmentY(CENTER_ALIGNMENT);
labelPwd.setBounds(50, 150, 100, 30);
fieldPassword.setBounds(150, 150, 100, 30);
this.getContentPane().add(labelPwd);
this.getContentPane().add(fieldPassword,BorderLayout.CENTER);
//用户类型
ButtonGroup group = new ButtonGroup();
JRadioButton student = new JRadioButton("学生", true); 
JRadioButton teacher = new JRadioButton("老师"); 
JRadioButton counsellor = new JRadioButton("辅导员"); 
group.add(student);
group.add(teacher);
group.add(counsellor);

JPanel panel = new JPanel(null);
// 设置用户类型选择面板的大小和位置
panel.setBounds(100, 200, 280, 40);
// 每个选项的大小
student.setBounds(20, 10, 80, 20);
teacher.setBounds(100, 10, 70, 20);
counsellor.setBounds(180, 10, 70, 20);
panel.add(student);
panel.add(teacher);
panel.add(counsellor);
this.getContentPane().add(panel);
//第6行为登录按钮
buttonLogin.setBounds(130,250,150,30);
this.getContentPane().add(buttonLogin);
this.setVisible(true);
}
}
